home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / GRAPH_FO / OUTLINEB.C < prev    next >
C/C++ Source or Header  |  1991-02-15  |  1KB  |  60 lines

  1. #include    <QuickDraw.h>
  2. #include    <WindowMgr.h>
  3. #include    <ControlMgr.h>
  4. #include    <DialogMgr.h>
  5. #include    <ToolBoxUtil.h>
  6.  
  7. static    short dfltID;
  8. /*
  9.  *    OutlineButton.c -- draw outlined button in dialog MM 89/10/22
  10.   * OutlineButton:    useritem procedure to draw the border around the OK
  11.   *                    (or other default)
  12.   *                    button.
  13.   */
  14. pascal void
  15. OutlineButton(theWindow, itemNo)
  16. DialogPtr    theWindow;
  17. int            itemNo;
  18. {
  19.     short                itype;
  20.     Handle                cHandle;
  21.     Rect                r;
  22.     PenState            ps;
  23.     Pattern                pat;
  24.  
  25.     GetIndPattern(&pat, sysPatListID, 4);
  26.  
  27.     GetPenState(&ps);
  28.     GetDItem(theWindow, dfltID, &itype, &cHandle, &r);
  29.     if((*((ControlHandle)cHandle))->contrlHilite == 255) {
  30.         PenPat(pat);
  31.         }
  32.     /* Get the location of the default button. */
  33.     GetDItem(theWindow, itemNo, &itype, &cHandle, &r);
  34.     PenSize(3,3);
  35.     FrameRoundRect(&r, 16, 16);
  36.     SetPenState(&ps);
  37. }
  38.  
  39.  
  40. void
  41. SetOutlineButton(theDialog, defaultID, useritemID)
  42. DialogPtr    theDialog;
  43. int        defaultID;
  44. int        useritemID;
  45. {
  46.     int        itype;
  47.     Handle    cHandle;
  48.     Rect    r;
  49.  
  50.     /* Get the location of the default button. */
  51.     GetDItem(theDialog, defaultID, &itype, &cHandle, &r);
  52.     dfltID = defaultID;
  53.  
  54.     /* Set up the useritem to wrap around the OK button and have
  55.        * userProc() as its drawing function.
  56.       */
  57.     InsetRect(&r, -4, -4);
  58.     SetDItem(theDialog, useritemID, userItem, (Handle) OutlineButton, &r);
  59. }
  60.